package Text16;

import java.io.*;

public class Main {
    //    第一行包含两个整数 n和 m，分别表示数的个数和操作次数。
//    第二行包含 n个整数，表示完整数列。
//    接下来 m行，每行包含三个整数 k,a,b（k=0，表示求子数列[a,b]的和；k=1，
//    表示第 a个数加 b）。数列从 1开始计数。
    static int N = 400010;
    static Node[] nodes = new Node[N];
    static int[] w = new int[N];

    public static void main(String[] args) throws IOException {
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(read.readLine());
        int m = Integer.parseInt(read.readLine());
        for (int i = 1; i <= n; i++) {
            w[i] = Integer.parseInt(read.readLine());
        }
        build(1, 1, n);
        while (m-- > 0) {
            int k = Integer.parseInt(read.readLine());
            int a = Integer.parseInt(read.readLine());
            int b = Integer.parseInt(read.readLine());
            if (k == 0) {
                writer.write(query(1, a, b));
            } else if (k == 1) {
                modify(1, a, b);
            }
        }
        writer.flush();
    }

    //修改操作，在u结点中，a位置加上b
    private static void modify(int u, int a, int b) {
        if (nodes[u].l == nodes[u].r) {
            nodes[u].sum += b;
        } else {
            int mid = nodes[u].l + nodes[u].r >> 1;
            if (a <= mid) {
                modify(u << 1, a, b);
            } else {
                modify(u << 1 | 1, a, b);
            }
            pushup(u);
        }
    }

    //查询某段区间的和
    private static int query(int u, int a, int b) {
        if (nodes[u].l >= a && nodes[u].r <= b) {
            return nodes[u].sum;
        }
        int mid = nodes[u].l + nodes[u].r >> 1;
        int res = 0;
        if (mid >= a) {
            res = query(u << 1, a, b);
        }
        if (mid + 1 <= b) {
            res += query(u << 1 | 1, a, b);
        }
        return res;
    }

    //在一段区间上初始化线段树，其中u表示根结点，l表示左边界，r表示右边界
    public static void build(int u, int l, int r) {
        if (l == r) {
            nodes[u] = new Node(l, r, w[l]);
        } else {
            nodes[u] = new Node(l, r);
            int mid = l + r >> 1;
            build(u << 1, l, mid);
            build(u << 1 | 1, mid + 1, r);
            pushup(u);
        }
    }

    //用子节点信息来更新当前节点信息（把信息往上传递）
    private static void pushup(int u) {
        nodes[u].sum = nodes[u << 1].sum + nodes[u << 1 | 1].sum;
    }
}

class Node {
    int l, r, sum;

    public Node(int l, int r, int sum) {
        this.l = l;
        this.r = r;
        this.sum = sum;
    }

    public Node(int l, int r) {
        this.l = l;
        this.r = r;
    }
}